﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Xiao.Application.Dto.App;
using Xiao.Application.Services.App;

namespace Xiao.Web.Controllers
{
    /// <summary>
    /// 版本模块
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProgramVersionController : ControllerBase
    {
        private readonly IProgramVersionService _programVersionService;
        public ProgramVersionController(
            IProgramVersionService programVersionService
            )
        {
            _programVersionService = programVersionService;
        }
        /// <summary>
        /// 获取程序版本信息
        /// </summary>
        /// <param name="Identification"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ProgramVersionDto> GetProgramVersion(string Identification)
        {
            return await _programVersionService.GetProgramVersion(Identification);
        }
        /// <summary>
        /// 添加程序版本信息
        /// </summary>
        /// <param name="program"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Guid> CreateProgramVersion(ProgramVersionDto program)
        {
            return await _programVersionService.CreateProgramVersion(program);
        }
    }
}
